package inc;
import java.util.ArrayList;

import android.os.Parcel;
import android.os.Parcelable;

public class Trip implements Parcelable {
	private String trip_name;
	private int sum;
	private ArrayList<Member> members;
	
	public Trip(String trip_name, ArrayList<Member> members, int sum) {
		this.setTrip_name(trip_name);
		this.setMembers(members);
		this.setSum(sum);
	}

	public ArrayList<Member> getMembers() {
		return members;
	}

	public void setMembers(ArrayList<Member> members) {
		this.members = members;
	}

	public int getSum() {
		return sum;
	}

	public void setSum(int sum) {
		this.sum = sum;
	}

	public String getTrip_name() {
		return trip_name;
	}

	public void setTrip_name(String trip_name) {
		this.trip_name = trip_name;
	}

	
	//parcel methods
	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(trip_name);
		dest.writeInt(sum);
		dest.writeList(members);
	}
	
	
	@SuppressWarnings("unchecked")
	public Trip(Parcel in) {
		this.trip_name = in.readString();
		this.sum = in.readInt();
		this.members = in.readArrayList(Member.class.getClassLoader());
	}
	
	public static final Parcelable.Creator<Trip> CREATOR = new Parcelable.Creator<Trip>() {
		public Trip createFromParcel(Parcel in) {
			return new Trip(in);
		}

		public Trip[] newArray(int size) {
			return new Trip[size];
		}
	};
}
